import {
  getToken
} from "../../../utils/getToken";

Page({
  data: {
    // 房屋详情
    list: []
  },
  onLoad(options) {
    console.log(options);
    this.getHouseEit(options.id)
  },
  getHouseEit(id) {
    wx.request({
      url: `https://live-api.itheima.net/room/${id}`,
      method: 'GET',
      header: {
        Authorization: 'Bearer ' + getToken()
      },
      success: (res) => {
        if (res.data.code !== 10000) {
          return wx.showToast({
            title: res.data.message,
          })
        }
        // console.log(res);
        this.setData({
          list: res.data.data
        })
      }
    })
  },
  editHouse() {
    console.log(this.data.list);
    wx.navigateTo({
      url: `/house_pkg/pages/form/index?id=${this.data.list.id}`,
    })
  },
})